refactor(build): serve generated entries through VirtualModulesPlugin at dedicated virtual paths - #80
Merged
Conversation
… at dedicated virtual paths Architecture reversal of the generated-source transport from PR #79's on-disk materialization, preserving all its conformance invariants: generated wrappers and registry modules keep their deterministic paths under the reserved .agent-bundle-virtual/ namespace but are now guaranteed-nonexistent module ids served from memory. Rslib validates source.entry existence on the real filesystem, so the profile keys each entry on the authored program and the invariant hook redirects the lowered Rspack entry to the virtual wrapper path — no real path is ever shadowed (the old entryAnchor overlay stays dead). A narrow feature check turns an upstream plugin removal into an actionable diagnostic.
…; truthful changeset headline Sol review should-fixes: a hostile tools hatch that strips plugins and repoints the entry is overridden by the framework hook (merged last); resolved environments missing the virtual-module plugin or the wrapper entry fail closed before the build; the conformance changeset headline no longer claims fully documented surfaces now that the virtual-module transport deliberately rides one experimental plugin behind a feature check.
|
| Name | Type |
|---|---|
| agent-bundle | Minor |
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
…wing Reuse the core isRecord guard for entry-record and descriptor narrowing (dropping two casts and the self-recursive entryImportsOf trick), inline the one-shot plannedVirtualModules helper at its composition site, hoist the per-entry registry-module computation in assertExecutableConfig, and drop the patch changeset that described replacing disk materialization no release ever shipped (the amended minor changeset already documents the virtual transport).
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Owner-requested architecture reversal of the generated-source transport from #79: generated wrapper entries and registry modules are served from memory through Rspack's
experiments.VirtualModulesPlugin(via@rslib/core's re-exportedrspack) instead of being written as throwaway files into the staged output root. This is not a revert of #79 — every conformance invariant it introduced is preserved and now has direct regression coverage.Virtual-path scheme
Every generated module keeps its deterministic, collision-safe path under the reserved namespace, but the path is now guaranteed-nonexistent (nothing ever writes it):
<outputRoot>/.agent-bundle-virtual/<entry-name>-entry.mjs<outputRoot>/.agent-bundle-virtual/<entry-name>-<index>.mjsRslib validates
source.entryexistence against the real filesystem before Rspack exists, so the composed profile keys each entry on the authored program and the framework invariant hook (merged last, unreachable by the consumertoolshatch) redirects the lowered Rspack entry to the virtual wrapper path and registers the plugin. No real path is ever shadowed — the pre-#79entryAnchoroverlay of the framework's own module stays dead.inspect --bundleroutput remains deterministic (the resolved bundler config shows the virtual path; the composed lib config shows the authored source plusgeneratedEntry).What was removed
mkdir/writeFilematerialization before the build and the recursivermcleanup infinally(build handles still close infinally).output.cleanDistPath: false. The pin itself stays: scripts, MCP entries, hooks, and MCP Apps build sequentially into one shared staged root, so a cleaning environment would delete sibling outputs — now proven by a test that seeds a sibling artifact and builds under a hostilecleanDistPath: truehatch.Experimental-API tradeoff
Accepted design decision, documented inline: a narrow feature check (
virtualModulesPluginConstructor) turns an upstream rename/removal of the experimental plugin into an actionable diagnostic instead of an opaque resolution failure.Preserved #79 invariants (each with coverage)
environmentConfigs[lib.id], configname)mergeRslibConfigcomposition, mutators return config, noas never@rspack/coredependency (value/types via@rslib/core)$) framework aliasescleanDistPath: falsepinned in final merge fragment + assertedfinallyNew fail-closed assertions: a resolved environment missing the plugin instance or the redirected wrapper entry aborts before the build; a hostile hatch that strips
config.pluginsand repointsconfig.entryis overridden by the framework hook (proven by a wrapper-only marker in the emitted bundle).Gate results (all local, this branch)
dev-package-build-service.test.tsre-run separately (11 passed; known include-list gap)test:packedincl. scaffolder e2e: 23 tests — 22 passed, 1 env-gated skipcheckboth greenIndependent pre-PR regression review (GPT Sol) focused on lost #79 invariants: no blockers; two should-fixes (hostile-hatch/fail-closed coverage, changeset headline truthfulness) addressed in the second commit; re-review verdict SHIP.
Changesets:
agent-bundlepatch for the transport change; the unreleased #79 changeset's transport/dist-cleaning bullets amended so combined release notes describe shipped behavior.